<template>
  <i v-if="isIconfont" :class="['el-icon sub-el-icon', icon]"></i>
  <el-icon v-else-if="icon" class="sub-el-icon">
    <component :is="icon" />
  </el-icon>
</template>

<script setup lang="ts">
import { computed } from "vue";
defineOptions({ name: "Icon" });
const props = defineProps({
  icon: String,
});

const isIconfont = computed(() => props.icon?.includes("iconfont"));
</script>

<style lang="scss">
.sub-el-icon {
  font-size: 20px;
  width: 20px;
  height: 20px;
}
</style>
